#pragma once
namespace util
{
#define SEP "\r\n"
#define SEP_LEN strlen(SEP)

    std::string getOneline(std::string &_packet)
    {
        auto pos = _packet.find(SEP);
        if (pos == _packet.npos)
        {
            std::cout << "getOneline error" << std::endl;
            return "";
        }
        std::string sub = _packet.substr(0, pos);
        _packet.erase(0, pos + SEP_LEN);
        return sub;
    }

    void ReadFile(const std::string &file, char *onbuffer)
    {
        std::ifstream in;
        in.open(file, std::ios::binary);
        in.read(onbuffer, 4096);
        in.close();
    }
}